]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Introduce PopupDummyMenu
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 4 Dec 2012 19:52:34 +0000 (14:52 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 8 Dec 2012 00:55:28 +0000 (19:55 -0500)
This is designed for things like the activities button that sort of
need a menu to make navigation work, but not really have it do anything.

https://bugzilla.gnome.org/show_bug.cgi?id=689109

js/ui/panel.js
js/ui/panelMenu.js
js/ui/popupMenu.js

index 3e7f38b65b6daaa39c2b89bd0964ff633170d770..712abd7d781e2048b638f10ec7f3ffc90d9ad85a 100644 (file)
@@ -599,11 +599,12 @@ const AppMenuButton = new Lang.Class({
 
             menu = new PopupMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
         } else {
-            if (this.menu && !(this.menu instanceof PopupMenu.RemoteMenu))
+            if (this.menu && this.menu.isDummyQuitMenu)
                 return;
 
             // fallback to older menu
             menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
+            menu.isDummyQuitMenu = true;
             menu.addAction(_("Quit"), Lang.bind(this, function() {
                 this._targetApp.request_quit();
             }));
index bdfa465d39f5c39267fe6783d7fb4d2d9fb1408a..9029b4e1751ea7d0a9f0ef4860370471e8cbf0f5 100644 (file)
@@ -112,7 +112,7 @@ const Button = new Lang.Class({
         this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
 
         if (dontCreateMenu)
-            this.menu = null;
+            this.menu = new PopupMenu.PopupDummyMenu(this.actor);
         else
             this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
 
index a50264e2985d154792f364657d01eb82342590e4..155a8546f3072aa09894cc6aa59950220ad877eb 100644 (file)
@@ -1274,6 +1274,27 @@ const PopupMenu = new Lang.Class({
     }
 });
 
+const PopupDummyMenu = new Lang.Class({
+    Name: 'PopupDummyMenu',
+
+    _init: function(sourceActor) {
+        this.sourceActor = sourceActor;
+        this.actor = sourceActor;
+        this.actor._delegate = this;
+    },
+
+    isChildMenu: function() {
+        return false;
+    },
+
+    open: function() { this.emit('open-state-changed', true); },
+    close: function() { this.emit('open-state-changed', false); },
+    destroy: function() {
+        this.emit('destroy');
+    },
+});
+Signals.addSignalMethods(PopupDummyMenu.prototype);
+
 const PopupSubMenu = new Lang.Class({
     Name: 'PopupSubMenu',
     Extends: PopupMenuBase,